// src/servers/servers.service.ts
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Server } from '../entities/server.entity';

@Injectable()
export class ServersService {
  constructor(
    @InjectRepository(Server)
    private serverRepository: Repository<Server>,
  ) {}

  async findAll(): Promise<Server[]> {
    return this.serverRepository.find();
  }

  async create(serverData: Partial<Server>): Promise<Server> {
    const server = this.serverRepository.create(serverData);
    return this.serverRepository.save(server);
  }
}
